package com.vvlive.caibao.smartcity.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RadioButton;

import com.vvlive.caibao.smartcity.base.Optional;

/**
 * Created by zhj on 2015/11/26.
 * 单选
 */
public class SingleOption extends RadioButton implements Optional {

    private int mChosen;

    public SingleOption(Context context) {
        this(context, null);
    }

    public SingleOption(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void setQuestion(CharSequence question) {
        this.setText(question);
    }

    @Override
    public void setDefaultChosen(int chosen) {
        mChosen = chosen;
    }

    @Override
    public String getQuestion() {
        return this.getText().toString();
    }

    @Override
    public int getChosenOption() {
        return mChosen;
    }
}
